	
		* Table 1
		* Balancing Tests

		
		clear all
		set more off
	
		use "C:\Users\EAsker\Desktop\ABR\data\ABR_final_data"
		************************************************************************
		******	Panel A: Balancing Test Based on NELS 1988
		
		keep if survey==1988
		
		egen student_id=group(stu_id survey)
		sort student_id survey wave mot_hs fat_hs white black hispanic female fam_inc
		duplicates drop student_id, force
		replace fam_inc=. if fam_inc==99|fam_inc==97|fam_inc==0
		gen ln_fam_inc=log(fam_inc)
		
		
		gen SFR=0
		replace SFR=1 if CSFR_year_BJH~=.
		
		drop if qrdinc80_b==2|qrdinc80_b==3 //Drop 2nd and 3rd quartiles
					
	foreach y of varlist mot_hs fat_hs ln_fam_inc not_white female {
		    
	reg `y'  SFR , cluster(fipst)
	outreg2 using Table_1.xls, append ctitle(`y') bdec(4) nonotes  nocons
		}
		
		************************************************************************
		******	Panel B: Balancing Test Based on All Three Surveys
		
		clear all
		set more off
	
		use "C:\Users\EAsker\Desktop\ABR\data\ABR_final_data"
		
		replace fam_inc=. if fam_inc==99|fam_inc==97|fam_inc==0
		gen ln_fam_inc=log(fam_inc)
		************************************************************************
		*********************** Drop 2nd and 3rd quartiles *********************
		
		drop if qrdinc80_b==2|qrdinc80_b==3 //Drop 2nd and 3rd quartiles
		
	egen student_id=group(stu_id survey)
	sort student_id survey wave mot_hs fat_hs white black hispanic female fam_inc
	duplicates drop student_id, force
		
			gen attrition=0
		replace attrition=1 if post_scndry==.
		
		************************************************************************
		*********************  Balancing Test **********************************
		************************************************************************
	
	foreach y of varlist mot_hs fat_hs ln_fam_inc not_white female attrition {
		    
		reghdfe `y'  qr1_sfr_BHJ, absorb ///
	(statexsurvey_quartile quartilexstate quartilexsurvey) cluster(quartilexstate) 
		
	outreg2 using "C:\Civic\ABR\output_2_15_24\Table_1.xls", ///
	append ctitle(`y')  sdec(4) bdec(4) nonotes  nocons
		
		}
		
	************************************************************************
	******	Panel C: Balancing Test Based on School District Attributes
	
	clear all 
	set more off
	
	use "C:\Users\EAsker\Desktop\ABR\data\ABR_final_data"
	
	duplicates drop ncesid, force
	
	drop year
	
	/* Merge the individual-level survey data with the finance data, 
	which includes district-level characteristics. */
	
	merge 1:m ncesid using "C:\Civic\ABR\data\finance_87_16.dta"
	
	drop if _merge~=3
	drop _merge
	
	egen state_year=group(fipst year1)
	egen quart_year=group(qrdinc80_b year1)
	
	drop if qrdinc80_b==2|qrdinc80_b==3
			
		foreach y of varlist pblack phisp pwhite pfle  {
		    
		reghdfe `y'   qr1_sfr_BHJ, ///
		absorb (state_year quart_year quartilexstate ) cluster (quartilexstate) 
		
	outreg2 using "C:\Civic\ABR\output_2_15_24\Table_1.xls", ///
	append ctitle(`y') bdec(4)  sdec(4) nonotes  nocons keep(qr1_sfr_BHJ) 

		}
		